 
 
    ***data paths 
   global archive /Volumes/Sans titre/DATA_MICROEU
   global posted /Volumes/Sans titre/DATA_MICROEU/Posting
   global data /Users/Mathilde/Dropbox/Posted_workers/Data
   global replication_outputs_a /Users/Mathilde/Dropbox/Posted_workers/Replication/Appendix_figures
   global replication_estimates /Users/Mathilde/Dropbox/Posted_workers/Replication/Main_estimates
   global replication_estimates_a /Users/Mathilde/Dropbox/Posted_workers/Replication/Appendix_estimates

   
   
   **output paths
  global replication_outputs_a /Users/Mathilde/Dropbox/Posted_workers/Replication/TNT_final/Replication_package/Appendix_figures
  global replication_estimates /Users/Mathilde/Dropbox/Posted_workers/Replication/TNT_final/Replication_package/Main_estimates
  global replication_estimates_a /Users/Mathilde/Dropbox/Posted_workers/Replication/TNT_final/Replication_package/Appendix_estimates
  global replication_outputs /Users/Mathilde/Dropbox/Posted_workers/Replication/TNT_final/Replication_package/Main_figures
  

   
   
   ********************************************************************
   * Replication file for Supplementary Figure C23
   ****************************************************************
 
 
 
 global varlist BEL BGR CZE DNK EST FIN FRA DEU HUN ITA LVA LTU LUX NLD NOR POL PRT ROU SVK SVN ESP SWE GBR 
 global nafta MEX CAN USA
 
 
 *First use imp approach 
 
 foreach x in EXP{
 	*publicly available data by WTO BPM6 
 import delimited "$data/OECD-WTO_BATIS_BPM6_Jan2021_bulk 2.csv", encoding(ISO-8859-1) clear
 keep if flow=="`x'"
 
 
 
 g eu_o=0
 g eu_d=0
 foreach y in $varlist{
 replace eu_o=1 if reporter=="`y'"
 replace eu_d=1 if partner=="`y'"
 
 }
 
 g nafta_o=0
 g nafta_d=0
 foreach y in $nafta{
 replace nafta_o=1 if reporter=="`y'"
 replace nafta_d=1 if partner=="`y'"
 
 }
 
 collapse (sum) final_value, by(item_code nafta* eu* year ) 
 
 
 g postable=.
 foreach y in SE  SB  SC{
 replace postable=1 if item_code=="`y'" 
 }
 
  foreach y in SF SH SG SI SL{
 replace postable=0 if item_code=="`y'" 
 }
 
 collapse (sum) final_value, by(postable eu* nafta* year)
 
  twoway (connected final_value year if eu_o==1 & eu_d==1 & postable==1 & year<2019, lcolor(cranberry) mcolor(cranberry)) ///
 (connected final_value year if eu_o==1 & eu_d==1 & postable==0 & year<2019, lcolor(black) mcolor(black)) ///
 , graphregion(fcolor(white) lcolor(white)) ///
 legend(label(1 "Construction, Transport, Industrial Services Abroad") ///
 label(2 "ICT, Finance, Insurance")  size(*0.9) cols(1))  xlabel(1988 (1) 2018, angle(vertical)) ///
 xtitle("") ytitle("Services Exports (Million Dollars)") ylabel(0 (100000) 300000)
 graph export "$replication_outputs_a/FigureC23a.pdf", replace

  
 
  twoway (connected final_value year if nafta_o==1 & nafta_d==1 & postable==1 & year<2019, lcolor(cranberry) mcolor(cranberry)) ///
 (connected final_value year if nafta_o==1 & nafta_d==1 & postable==0 & year<2019, lcolor(black) mcolor(black)) ///
 , graphregion(fcolor(white) lcolor(white)) ///
 legend(label(1 "Construction, Transport, Industrial Services Abroad") ///
 label(2 "ICT, Finance, Insurance") size(*0.9) cols(1))  xlabel(1988 (1) 2018, angle(vertical)) ///
 xtitle("") ytitle("Services Exports (Million Dollars)") ylabel(0 (20000) 60000)
 graph export "$replication_outputs_a/FigureC23b.pdf", replace
  
  
 twoway (connected final_value year if eu_o==1 & eu_d==1 & postable==1 & year<2019, lcolor(cranberry) mcolor(cranberry)) ///
 (connected final_value year if eu_o==1 & eu_d==1 & postable==0 & year<2019, lcolor(black) mcolor(black)) ///
 , graphregion(fcolor(white) lcolor(white)) ///
 legend(label(1 "Construction, Transport, Industrial Services Abroad") ///
 label(2 "ICT, Finance, Insurance")  size(*0.9) cols(1))  xlabel(2005 (1) 2018, angle(vertical)) ///
 xtitle("") ytitle("Services Exports (Million Dollars)") ylabel(0 (100000) 300000)

  
 
  twoway (connected final_value year if nafta_o==1 & nafta_d==1 & postable==1 & year<2019, lcolor(cranberry) mcolor(cranberry)) ///
 (connected final_value year if nafta_o==1 & nafta_d==1 & postable==0 & year<2019, lcolor(black) mcolor(black)) ///
 , graphregion(fcolor(white) lcolor(white)) ///
 legend(label(1 "Construction, Transport, Industrial Services Abroad") ///
 label(2 "ICT, Finance, Insurance")  size(*0.9) cols(1))  xlabel(2005 (1) 2018, angle(vertical)) ///
 xtitle("") ytitle("Services Exports (Million Dollars)") ylabel(0 (20000) 60000)
  graph export "$outputs/NEFTA_wto_altlegend_`x'.pdf", replace

 
 
 }
 
 
 
